package cn.jw.starter.web.common;

import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;

import lombok.extern.slf4j.Slf4j;

/**
 * @author 王广帅
 * @version 1.0.0
 * @since 2025/3/2 10:34
 */
@Slf4j
public class ServiceStartResultHandler implements ApplicationListener<ApplicationEvent> {

    @Override
    public void onApplicationEvent(ApplicationEvent event) {
        if (event instanceof ApplicationFailedEvent) {
            log.error("====服务启动失败了,快修复一下吧====");
        } else if (event instanceof ApplicationReadyEvent) {
            log.warn("====恭喜,服务启动成功====");
        }
    }
}
